﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    public class ApiDBContext:DbContext
    {
        private readonly string? _CnnectionString;
        public ApiDBContext(DbContextOptions<ApiDBContext> opts, IConfiguration configuration) : base(opts)
        {
            _CnnectionString = configuration.GetConnectionString("AIYDB_MySql");

        }
        DbSet<EntityUser> EntityUser { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //optionsBuilder.UseMySql(_CnnectionString.new MySqlServerVersion(new Version(9, 2, 0)));
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //modelBuilder.UseCollation("utf8mb4").HasCharSet("utf8mb4_german2_ci");
        }
    }
}
